package com.zghhost.stockweb.pojo;

import com.zghhost.stockweb.util.NumberUtil;

import java.util.List;

/**
 * @author guohua.zhang@zhaopin.com.cn
 * @Date 2019/5/17 14:45
 */
public class WangyiYidongBean implements Comparable<WangyiYidongBean>{
    private Double HSL;
    private List<Double> NUMBER;
    private Double PRICE;
    private String INFO;
    private String NAME;
    private List<String> TYPES;
    private String DATE;
    private String CODE;
    private String SYMBOL;
    private Double PERCENT;
    private String TITLE;
    private Integer RN;
    private String TYPE;
    private Integer TYPE_COLOR;

    private Double staamount;

    private String currentPrice;
    private String updownRate;

    public Double getHSL() {
        return HSL;
    }

    public void setHSL(Double HSL) {
        this.HSL = HSL;
    }

    public List<Double> getNUMBER() {
        return NUMBER;
    }

    public void setNUMBER(List<Double> NUMBER) {
        this.NUMBER = NUMBER;
    }

    public Double getPRICE() {
        return PRICE;
    }

    public void setPRICE(Double PRICE) {
        this.PRICE = PRICE;
    }

    public String getINFO() {
        return INFO;
    }

    public void setINFO(String INFO) {
        this.INFO = INFO;
    }

    public String getNAME() {
        return NAME;
    }

    public void setNAME(String NAME) {
        this.NAME = NAME;
    }

    public List<String> getTYPES() {
        return TYPES;
    }

    public void setTYPES(List<String> TYPES) {
        this.TYPES = TYPES;
    }

    public String getDATE() {
        return DATE;
    }

    public void setDATE(String DATE) {
        this.DATE = DATE;
    }

    public String getCODE() {
        return CODE;
    }

    public String getCODEStr(){
        if(CODE != null && CODE.length() == 7 ){
            return CODE.substring(1);
        }
        return CODE;
    }

    public void setCODE(String CODE) {
        this.CODE = CODE;
    }

    public String getSYMBOL() {
        return SYMBOL;
    }

    public void setSYMBOL(String SYMBOL) {
        this.SYMBOL = SYMBOL;
    }

    public Double getPERCENT() {
        return PERCENT;
    }

    public void setPERCENT(Double PERCENT) {
        this.PERCENT = PERCENT;
    }

    public String getTITLE() {
        return TITLE;
    }

    public void setTITLE(String TITLE) {
        this.TITLE = TITLE;
    }

    public Integer getRN() {
        return RN;
    }

    public void setRN(Integer RN) {
        this.RN = RN;
    }

    public String getTYPE() {
        return TYPE;
    }

    public void setTYPE(String TYPE) {
        this.TYPE = TYPE;
    }

    public Integer getTYPE_COLOR() {
        return TYPE_COLOR;
    }

    public void setTYPE_COLOR(Integer TYPE_COLOR) {
        this.TYPE_COLOR = TYPE_COLOR;
    }

    public Double getAMOUNT(){
        Double x = 0D;
        if(NUMBER != null && NUMBER.size() > 0){
            for(Double d : NUMBER){
                x += d*PRICE;
            }
        }
        return x;
    }

    public Double getStaamount() {
        return staamount;
    }

    public void setStaamount(Double staamount) {
        this.staamount = staamount;
    }

    public String getCurrentPrice() {
        return currentPrice;
    }

    public void setCurrentPrice(String currentPrice) {
        this.currentPrice = currentPrice;
    }

    public String getUpdownRate() {
        return updownRate;
    }

    public void setUpdownRate(String updownRate) {
        this.updownRate = updownRate;
    }

    @Override
    public int compareTo(WangyiYidongBean o) {
        return this.getStaamount().compareTo(o.getStaamount());
    }

    public String getStaamountStr() {
        if(staamount < 0){
            return "-"+NumberUtil.formatNum(""+Math.abs(staamount),false);
        }else {
            return NumberUtil.formatNum(""+staamount,false);
        }
    }

    public String getAmountStr(){
        if(TYPE.indexOf("卖") != -1){
            return "-"+NumberUtil.formatNum(""+getAMOUNT(),false);
        }else {
            return NumberUtil.formatNum(""+getAMOUNT(),false);
        }
    }

    @Override
    public String toString() {
        return "" +
                "DATE='" + DATE + '\'' +
                ", SYMBOL='" + SYMBOL + '\'' +
                ", NAME='" + NAME + '\'' +
                ", NUMBER=" + NUMBER +
                ", PRICE=" + PRICE +
                ", AMOUNT=" + NumberUtil.formatNum(""+getAMOUNT(),false) +
                ", HSL=" + HSL + '\'' +
                ", INFO='" + INFO + '\'' +
                ", TYPES=" + TYPES +
                ", CODE='" + CODE + '\'' +
                ", PERCENT=" + PERCENT +
                ", TITLE='" + TITLE + '\'' +
                ", RN=" + RN +
                ", TYPE='" + TYPE + '\'' +
                ", staamount=" + staamount +
                ", TYPE_COLOR=" + TYPE_COLOR;
    }
}
